<?php
    function drawMenu($dataMenu)
    {
        $menu = "<div class='sidebar-scroll'>";
        $menu .=   "<div id='sidebar' class='nav-collapse collapse'>";
              //BEGIN RESPONSIVE QUICK SEARCH FORM
         $menu .=   "<div class='navbar-inverse'>";
         $menu .=   "<form class='navbar-search visible-phone'>";
         $menu .=       "<input type='text' class='search-query' placeholder='Search' />";
         $menu .=   "</form>";
         $menu .=   "</div>";
              //END RESPONSIVE QUICK SEARCH FORM
              //BEGIN SIDEBAR MENU
        $menu .=   "<ul class='sidebar-menu'>";
        if(count($dataMenu['menuArray0'])>0){
            foreach ($dataMenu['menuArray0'] as $data) {
                $arrayMenu = explode(',',$data);
                $menu .= "<li class='sub-menu'>"; 
                $menu .=     "<a href='".base_url().$arrayMenu[3]."' class=''>";
                $menu .=    "<i class='".$arrayMenu[4]."'></i>";                
                $menu .=     "<span>".$arrayMenu[1]."</span>";
                $menu .= "<span class='arrow'></span>";
                $menu .= "</a>";

                $menu .= "<ul class='sub'>";
                if(count($dataMenu['menuArray1'])>0){
                    foreach ($dataMenu['menuArray1'] as $data1) {
                        $arrayMenu1 = explode(',',$data1);
                        if($arrayMenu1[4]==$arrayMenu[0]){
                            $menu .= "<li><a class='active' href='".$arrayMenu1[3]."'>".$arrayMenu1[1]."</a></li>";         
                        }
                    }   
                }   
                $menu .= "</ul>";
            $menu .= "</li>";               
            }
        }
        $menu .= "</ul>";   
        $menu .= "</div>";  
        $menu .= "</div>";  
        return $menu;
    }
?>